// 检查数据库title字段的脚本
const mysql = require('mysql2/promise');
require('dotenv').config();

async function checkDbTitle() {
  try {
    // 创建数据库连接
    const pool = mysql.createPool({
      host: process.env.DB_HOST || 'localhost',
      user: process.env.DB_USER || 'root',
      password: process.env.DB_PASSWORD || '',
      database: process.env.DB_NAME || 'community_service_platform',
      port: process.env.DB_PORT || 3306
    });

    // 查询技能共享表
    const [rows] = await pool.execute('SELECT * FROM shared_skills WHERE skill_id = 1');
    console.log('数据库查询结果:');
    console.log(JSON.stringify(rows, null, 2));

    // 关闭连接
    await pool.end();
  } catch (error) {
    console.error('数据库查询失败:', error.message);
  }
}

checkDbTitle();